#include <iostream>
#include <vector>
#include <climits>

using namespace std;

// https://leetcode.cn/problems/maximum-product-subarray/
// 152. 乘积最大子数组

class Solution
{
public:
    int maxProduct(vector<int> &nums)
    {
        int ans = INT_MIN;
        int maxMul = 1;
        int minMul = 1;
        for (int i = 0; i < nums.size(); i++)
        {
            int curMaxMul = maxMul * nums[i];
            int curMinMul = minMul * nums[i];
            maxMul = max(nums[i], max(curMaxMul, curMinMul));
            minMul = min(nums[i], min(curMaxMul, curMinMul));
            ans = max(maxMul, ans);
        }
        return ans;
    }
};

int main()
{
    return 0;
}